<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>{$page['title']}</title>
    <meta name="keywords" content="{$page['keywords']}" />
    <meta name="description" content="{$page['description']|clearh}" />
    <script src="__PUBLIC__/js/jquery-1.3.2.min.js"></script>
    <script src="__PUBLIC__/js/jquery.simplemodal.js"></script>
    <script src="__PUBLIC__/js/jquery.form.js"></script>
	<link href="__PUBLIC__/default/css/global.css" rel="stylesheet" type="text/css" />
    <link href="__PUBLIC__/default/css/group_thread.css" rel="stylesheet" type="text/css" />
	<style type="text/css">
	#simplemodal-overlay {background-color:#000; cursor:wait;}
	#simplemodal-container {height:320px; width:600px; color:#111; background-color:#eee; border:4px solid #444; padding:12px;}
	#simplemodal-container code {background:#141414; border-left:3px solid #65B43D; color:#bbb; display:block; margin-bottom:12px; padding:4px 6px 6px;}
	#simplemodal-container a {color:#ddd;}
	#simplemodal-container a.modalCloseImg {background:url(__PUBLIC__/default/images/x.png) no-repeat; width:25px; height:29px; display:inline; z-index:3200; position:absolute; top:-15px; right:-16px; cursor:pointer;}
	#simplemodal-container #basic-modal-content {padding:8px;}
</style>
<script type="text/javascript">
    var HOST = window.location.host;
    var Per_host = "http://" + HOST;
    var JS_PATH = "../Public/js/";
    var IMG_PATH = "../Public/images/";
    var URL = '__URL__';
    var APP = '__APP__';
    var PUBLIC = '../Public/';
    var REQUEST_URI = '{$_SERVER.REQUEST_URI}';
	function ready(){
		$(document).ready(function(){
			$('a.add_post').click(function(e){
				id = this.id.substr(6);
				act = this.id.substr(0, 5);
				if(act == "renew"){
					$("#requery").val(0);
					$("#qid").val(0);
				}
				if (act == "quote") {
					$("#requery").val(id);
					$("#qid").val(0);
				}
				if(act == "reply"){
					$("#requery").val(0);
					$("#qid").val(id);
				}
				
				e.preventDefault();
				var tourl = APP + '/Public/ajax_is_login';
				$.post(tourl, '', function(data){
					if (data['status'] == 1) {
						$('#basic-modal-content').modal();
					}
					else {
						alert(data['info']);
						$('#login').modal();
					}
				}, 'json');
			});
			var option = {
				dataType: 'json',
				success: processJson
			};
			var option_login = {
				dataType: 'json',
				success: login
			};
			$('#add_post').ajaxForm(option);
			$('#post_login').ajaxForm(option_login);
			
		});
	}
	ready();
	function processJson(data){
		//var id=this.id.substr(6);
		//var act=this.id.substr(0,5);
		
		
		if(data['status']==1){
			alert(data['info']);
			if(act=="reply"){
				id="#new_reply_"+id;
				var text='<div class="toreply"><h2>'+$("#title").val()+'</h2><div class="face">';
					text+='<img src="{@info.avatar}" /><br>'+data['data']['username']+'</div><div class="message">'+$("#message").val()+'<span class="time"></span><span class="time">';
					text+=data['data']['dateline']+'</span></div></div>';
			}else{
				id="#new_post";
				var text='<div class="reply" id="thread_'+data['data']['id']+'"><h2>'+$("#title").val()+'</h2>';
					text+='<div class="face"><img src="{@info.avatar}" /><br>'+data['data']['username']+'</div>';
					text+='<div class="message">'+$("#message").val()+'<span class="time"><a href="#" id="reply_'+data['data']['id']+'" class="add_post">[ Reply ]</a>   <a href="#" id="quote_'+data['data']['id']+'" class="add_post">[ Quote ]</a>   <a href="#">[ Report ]</a>';
					text+='</span><span class="time"><a href="#thread_'+data['data']['l']+'">#'+data['data']['l']+'</a> '+data['data']['dateline']+'</span><div id="new_reply_'+data['data']['id']+'" style="display:none;"></div>';
			}
			$(id).prepend(text);
			$(id).show();
			ready();
			$.modal.close();
		}else{
			alert(data['data']);
			if(data['data']=="login"){
				$.modal.close();
				$('#login').modal();
			}else{
				alert(data['info']);
			}

		} 
	}
	function login(data){
		if(data['status']==1){
			alert(data['info']);
			$.modal.close();
			$('#basic-modal-content').modal();
		}else{
			alert(data['info']);

		} 
	}
</script>
</head>
<body>
<include file="Public:top"/>
    <!--中间开始-->
    <div id="main">
        <div class="right">
            <div class="next_lssue">
                <div class="next-bg">
                    New Topics
                </div>
                <div class="next-n">
                    <ul>
<if condition="$new_topics">
	<volist name="new_topics" id="v">
                        <li>
                            {$i}.<a href="__APP__/grpts/{$v['id']}.html">{$v['title']}</a>
                        </li>
	</volist>
</if>
                    </ul>
                </div>
<if condition="$group">
                <div class="conter-group" style="background-color:#f3f3f3;">
                    <div class="group"><a href="__APP__/group.html">Featured Groups</a></div>
	<volist name="group" id="g">
                        <dl class="group-x">
                        <dt><a href="__APP__/grps/{$g['id']}.html"><img src="{$g['pic']|toImg=group}" alt="{$g['groupname']}" /></a></dt>
                        <dd>
                            <h5><a href="__APP__/grps/{$g['id']}.html" title="{$g['groupname']}">{$g['groupname']}</a></h5>
                            <p>Member:{$g['membernum']}<br/>Topic:{$g['threadnum']}</p>
                        </dd>
                    </dl>
	</volist>
                </div>
</if>
                <div class="clear"></div>
            </div>
            <div class="guang"></div>
            <div style="margin-bottom:10px; text-align:center">
        	<script type="text/javascript"><!--
			google_ad_client = "pub-0787067378614221";
			/* 200x200, 创建于 10-8-27 event_group_all_r */
			google_ad_slot = "2776601511";
			google_ad_width = 200;
			google_ad_height = 200;
			//-->
			</script>
			<script type="text/javascript"
			src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
			</script>
        </div>
        </div>
        <div class="n-life">
            <div class="classifieds content">
                <div class="content-bg">
                    <a href="__APP__/">Home</a> > <a href="__APP__/Group/index">Groups</a> > 
                <if condition="$dh">
                    <if condition="$dh[_pid]">
                        <a href="__APP__/glist/{$dh[_pid]['id']}.html">{$dh[_pid]['title']}</a> >
                    </if>
                    <a href="__APP__/glist/{$dh['id']}.html">{$dh['title']}</a> > 
                </if>
                	<a href="__APP__/grps/{$ginfo['id']}.html">{$ginfo['groupname']}</a>
                </div>
                <div class="content-n">
                	<div class="thread">
						<h1>{$info['title']}</h1>
						<div class="face">
							<img src="{$info['uid']|get_avatar}" alt="xd" /><br>{$info['username']}
						</div>
						<div class="message">
							{$info['message']}
                            <div style="margin-bottom:10px; text-align:center">
								<script type="text/javascript"><!--
								google_ad_client = "pub-0787067378614221";
								/* 468x60, 创建于 10-8-27 thread_content */
								google_ad_slot = "0505340472";
								google_ad_width = 468;
								google_ad_height = 60;
								//-->
								</script>
								<script type="text/javascript"
								src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
								</script>
                            </div>
							<span class="time">
								<a href="#" id="renew_{$info['id']}" class="add_post">[ Reply ]</a>   
								<!--a href="#">[ Report ]</a-->
							</span>
							<span class="time"><a href="#thread_{$info['l']}">#{$info['l']}</a> {$info['dateline']|toDate='m-d-Y H:i:s'}</span>
						</div>
					</div>
					<div id="new_post" style="display:none;"></div>
<volist name="thread" id="v">
					<div class="reply" id="thread_{$v['l']}">
						<!--h2>{$v['title']}</h2-->
						<div class="face">
							<img src="{$v['uid']|get_avatar}" alt="{$v['username']}" /><br>{$v['username']}
						</div>
						<div class="message">
							{$v['message']}
							<span class="time">
								<a href="#" id="reply_{$v['id']}" class="add_post">[ Reply ]</a>   
									<a href="#" id="quote_{$v['id']}" class="add_post">[ Quote ]</a>   
									<!--a href="#">[ Report ]</a-->
							</span>
							<span class="time">
								<a href="#thread_{$v['l']}">#{$v['l']}</a> {$v['dateline']|toDate='m-d-Y H:i:s'}
							</span>
							<div id="new_reply_{$v['id']}" style="display:none;"></div>
	<volist name="v['_rarr']" id="rv">
							<div class="toreply">
								<!--h2>{$rv['title']}</h2-->
								<div class="face">
									<img src="{$rv['uid']|get_avatar}" alt="{$rv['username']}" /><br>{$rv['username']}
								</div>
								<div class="message">
									{$rv['message']}
									<span class="time"></span>
									<span class="time">
										{$rv['dateline']|toDate='m-d-Y H:i:s'}
									</span>
								</div>
							</div>
	</volist>
						</div>
					</div>
</volist>
                </div>
                <div class="clear">
                </div>
            </div>
        </div>
        <div class="clear">
        </div>
    </div>
<div id="basic-modal-content" style="display:none;">
<form action="__URL__/add_post" method="post" id="add_post">
	<input type="hidden" name="topid" value="{$info['id']}" />
	<input type="hidden" name="gid" value="{$info['gid']}" />
	<input type="hidden" id="requery" name="requery" value="0" />
	<input type="hidden" id="qid" name="qid" value="0" />
	<fieldset class="post">
		<legend>Reply</legend>
		<!--p>
			<label for="title">Title:</label>
			<input type="text" name="title" id="title" style="width:450px;" />
		</p-->
		<p>
			<label for="message">Content:</label>
			<textarea name="message" id="message" cols="45" rows="8"></textarea>
		</p>
		<p style=" text-align:right; padding-right:50px;">
			<input type="submit" value="Submit" />
		</p>
	</fieldset>
</form>
<span id="v_title"></span>
<span id="v_message"></span>
</div>
<div id="login" style="display:none;">
<form action="__APP__/Public/check" method="post" id="post_login">
	<input type="hidden" name="is_ajax" value="1" />
	<fieldset class="post">
		<legend>Login</legend>
		<p>
			<label for="username">User name:</label>
			<input type="text" name="username" id="username" style="width:200px;" />
		</p>
		<p>
			<label for="password">Password:</label>
			<input type="password" name="password" id="password" style="width:200px;"/>
		</p>
		<p style=" text-align:right; padding-right:50px;">
			<input type="submit" value="Submit" />
		</p>
	</fieldset>
</form>
</div>
<include file="Public:foot"/>